#include "CorePch.h"
#include "JPointer.h"
namespace JJc
{
template<typename T>
bool JPointer<T>::operator ==(const JPointer<T>& pointer) const 
{
	return this.m_p == pointer.m_p;
}

template<typename T>
bool JPointer<T>::operator==( const T* const p) const
{
	return this->m_p == p;
}

template<typename T>
JPointer<T>& JPointer<T>::operator=( const JPointer<T>& pointer)
{
	if( this->m_p!=pointer.m_p)
	{
		if( this->m_p )
		{
			m_p->DecreaseReference();
		}
		if( pointer.m_p )
		{
			pointer.m_p->IncreaseReference();
		}
		this->m_p = pointer.m_p;
	}
	return *this;
}

template<typename T>
JPointer<T>& JPointer<T>::operator=( T* p)
{
	if( m_p!=p)
	{
		if(m_p)
		{
			m_p->DecreaseReference();
		}
		if(p)
		{
			p->IncreaseReference();
		}
		m_p = p;
	}
	return *this;
}

//template<typename T>
//JPointer<T>& JPointer<T>::operator->()
//{
//	return *m_pointer;
//}


}